CREATE DATABASE AsWPSJ
GO
CREATE TABLE Users(
	ID INT IDENTITY(1,1),
	LoginName VARCHAR(20),
	PASS VARCHAR(50),
	HoTen NVARCHAR(200) PRIMARY KEY,
	Email NVARCHAR(200),
	BirthDay DATETIME,
	PhoneNumber VARCHAR(50),
	Avatar IMAGE,
	ROLE bit default '1'
)
GO

CREATE TABLE Album(
	ID int,
	Name NVARCHAR(MAX),
	_YEAR NVARCHAR(50),
	SingerName NVARCHAR(200) REFERENCES Singer(SingerName)
)
GO
CREATE TABLE Songs
(	
	ID INT IDENTITY(1,1),
	Name NVARCHAR(200),
	SingerName NVARCHAR(200) REFERENCES Singer(SingerName),
	[Type] NVARCHAR(100) REFERENCES MusicType([Type]),
	Uploader NVARCHAR(200) REFERENCES Users(HoTen),
	Author NVARCHAR(100)
)
CREATE TABLE MusicType
(	
	ID INT IDENTITY(1,1),
	[Type] NVARCHAR(100) PRIMARY KEY
)
GO
CREATE TABLE Singer(
	ID INT IDENTITY(1,1),
	SingerName NVARCHAR(200) PRIMARY KEY
)